﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MonthCalendar;
using Db4objects.Db4o;
using Db4objects.Db4o.Linq;

namespace Yosca
{
	/// <summary>
	/// Interaction logic for HomeControl.xaml
	/// </summary>
	public partial class HomeControl : UserControl
	{
		public HomeControl()
		{
			this.InitializeComponent();
		}
        public void addAppointmentsToPane()
        {
            AppointmentDB adb = AppointmentDB.Instance;
            IEnumerable<Appointment> aList = from Appointment a in adb.db
                                             where a.StartTime.Value.Date.ToShortDateString().Equals(System.DateTime.Now.ToShortDateString())
                                             select a;
            this.stackAdder.Children.Clear();
            foreach (Appointment a in aList)
            {
                appointmentInfo aI = new appointmentInfo();
                aI.eventNameLabel.Content = a.Subject.ToUpper();
                aI.eventTimeLabel.Content = a.StartTime.Value.ToShortTimeString() + "-" + a.EndTime.Value.ToShortTimeString();
                aI.eventDescBlock.Text = a.Details.ToUpper();
                aI.eventInvLabel.Content = a.invNum == -1 ? "Personal" : a.invNum.ToString();
                //aI.eventInvLabel.Content = a.invNum.ToString();
                this.stackAdder.Children.Add(aI);

            }
            scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;


        }
	}
}